package Objet;

@SuppressWarnings("rawtypes")
public class Objet implements java.lang.Comparable {
	private final int	num;
	private final int	poids;
	private final int	util;

	public Objet(int num, int poids, int util) {
		this.num = num;
		this.poids = poids;
		this.util = util;
	}

	public String affiche() {
		return "(" + this.num + "," + this.poids + "," + this.util + ")";
	}

	@Override
	public int compareTo(Object t2) {
		if (this.getratio() < ((Objet) t2).getratio()) {
			return 1;
		} else
			if (this.getratio() == ((Objet) t2).getratio()) {
				return 0;
			} else {
				return -1;
			}
	}

	public int getnum() {
		return this.num;
	}

	public int getpoids() {
		return this.poids;
	}

	public double getratio() {
		return (double) this.util / this.poids;

	}

	public int getutil() {
		return this.util;
	}
}